<template>
  <div class="testForm">
    <basic-form :basicFormConfig="basicFormConfig"></basic-form>
  </div>
</template>
<script>
import BasicForm from "@/components/basicForm";
export default {
  components: {
    BasicForm,
  },
  data() {
    const validateUnit = (rule, value, callback) => {
      if (value) {
        callback()
      }else{
        callback(new Error("单位不能为空"));
      }
    };
    return {
      basicFormConfig: {
        labelWidth: "120px",
        formConfig: [
          {
            label: "部门",
            prop: "unit",
            span: 24,
            type: "input",
          },
          {
            label: "姓名",
            prop: "name",
            type: "input",
          },
          {
            label: "部门",
            prop: "unit",
            type: "input",
          },
        ],
        formButtonConfig: [],
        rules: {
          unit: [{ required: true, validator: validateUnit }],
          name: [{ required: true, message: '姓名不能为空' }],
        },
        // data:{}
      },
    };
  },
};
</script>
<style lang="scss" scoped>
</style>